UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RY5zL4K2zoBF45m/JnlaonjedcACjGHxaPLyk8iWWcg=' 
WHERE 
  key_id = '1310316ef85e47ba5455da7d98010e68745c67a27bd4ffaa33d331383a5ae62a' 
  AND (
    token = 'RY5zL4K2zoBF45m/JnlaonjedcACjGHxaPLyk8iWWcg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038