UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KTCBrVLQazJEizya86uBXMSfeEmLMpEGFXMF5DkcVE8=' 
WHERE 
  key_id = 'abdf785c55057c66e95af8f4293310dba8f742735fc8445177dee081f4f34626' 
  AND (
    token = 'KTCBrVLQazJEizya86uBXMSfeEmLMpEGFXMF5DkcVE8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030