UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LySCZRH6gXovKw9jUL4fpVrIqI/DRItZT7bfdkiWf/8=' 
WHERE 
  key_id = 'cdee203b4fa9c20dd91cf75790620731b5a9ae57b9a779bd8a270ebcdfc64559' 
  AND (
    token = 'LySCZRH6gXovKw9jUL4fpVrIqI/DRItZT7bfdkiWf/8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032