UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6dZTGXtmuWDgvKcDfShNmzk2RHf5WqbnIQ3L3WdKeWQ=' 
WHERE 
  key_id = 'f8baf992b4143bd5c5962f61b5f8f88410ae1c7425551190d8f8bf899f9c0ca9' 
  AND (
    token = '6dZTGXtmuWDgvKcDfShNmzk2RHf5WqbnIQ3L3WdKeWQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034