UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ARk6tL9UDCMOY3PiRRDigfOdZ6bdhMcDn44njbwHgf4='
WHERE
key_id = '171cd08819ff752add475017d01eb4b65f3ab580744a6e0f34817875cffdf702'
AND (
token = 'ARk6tL9UDCMOY3PiRRDigfOdZ6bdhMcDn44njbwHgf4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)