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

Query time 0.00042