UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PEtKIf9TArSMfxoTLMuASgxWFp6L9MkaTku5w93H/uk=' 
WHERE 
  key_id = '6e51c2e8a3e63457639c060841231a1d50506a9f50431c3b14da9c527af419f5' 
  AND (
    token = 'PEtKIf9TArSMfxoTLMuASgxWFp6L9MkaTku5w93H/uk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015