UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P51Q3tO2z/prwEY/t9JRWRKDlZIlMCkHNlr1VlLTRw4='
WHERE
key_id = 'de471a022e943e44f08a29fe0158dd9bf3c76bdba5a5cc0e2811f531146146f8'
AND (
token = 'P51Q3tO2z/prwEY/t9JRWRKDlZIlMCkHNlr1VlLTRw4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)