UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IGJ3DJbNbd1IcAY6M0G0FLY8LwNJcIkwMEpVDb5tMc4=' 
WHERE 
  key_id = '1bedd9cf77f6a418d67f19514044930cc3c28449d379b65c7156de569781c662' 
  AND (
    token = 'IGJ3DJbNbd1IcAY6M0G0FLY8LwNJcIkwMEpVDb5tMc4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023