UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G5W/RPiawDfV1MXU0mWxdZvSmAskVwVPFGAZiUyf1I8=' 
WHERE 
  key_id = '8bd3a7ea1690b14b18d743bde86ce340c7ff0f9c1e12d1ac82a656133fba4d83' 
  AND (
    token = 'G5W/RPiawDfV1MXU0mWxdZvSmAskVwVPFGAZiUyf1I8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038