UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I4Rz/vJF5gTTzUZ9FLiG/xeIjnl4HkXj+QxKSkKT9jA=' 
WHERE 
  key_id = '8445a4b3ed77718789224efb6dd6f3b7f1d638befd88d068c4371756de2d6503' 
  AND (
    token = 'I4Rz/vJF5gTTzUZ9FLiG/xeIjnl4HkXj+QxKSkKT9jA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040