UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BqHBXZX10yaFKfgC7Q4t5FKfbfVHbkEKN1SKQNJN6q0=' 
WHERE 
  key_id = '88a4b406d2403308c028fae126b7005c79f694fc63892393e06177176cc6a365' 
  AND (
    token = 'BqHBXZX10yaFKfgC7Q4t5FKfbfVHbkEKN1SKQNJN6q0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036