UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Jva1SOEuFvnX+K7BYqBidfJyH+lr+NBnlT4mwa2VK3w=' 
WHERE 
  key_id = '965f84197dfaf760e80ea4c02e02685e1195e802c0509b9883a71ad8e4875ede' 
  AND (
    token = 'Jva1SOEuFvnX+K7BYqBidfJyH+lr+NBnlT4mwa2VK3w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050