UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dbL8VHTAKnemH2TV+BvrIV+l8amyUXr0WiB8XTTDxoI=' 
WHERE 
  key_id = '6c15e04b58740c23bf57f0017278f40029782e4abac73a41bab77d2a65f1e9f3' 
  AND (
    token = 'dbL8VHTAKnemH2TV+BvrIV+l8amyUXr0WiB8XTTDxoI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053