UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3nCuWlkUqIlN50ipYasiKxFjQYDFC9h3qt3l/puAlBk=' 
WHERE 
  key_id = '3fef6d172d3064a3369a65aa1788210b8950ceb292cbf194154b9ef7aeeca565' 
  AND (
    token = '3nCuWlkUqIlN50ipYasiKxFjQYDFC9h3qt3l/puAlBk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051