UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2FED26iYqrvRas42CsgDiPkaGi+YOUdrFBe2i42WgGo='
WHERE
key_id = 'a51429f40142140de2f02961b0462b0570742acc8ba16e3fed490124b9f0645c'
AND (
token = '2FED26iYqrvRas42CsgDiPkaGi+YOUdrFBe2i42WgGo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)