UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'y0xEkW2BR5u8szzorIYkPMF1z6mtJHBHgxNAtku6vaI='
WHERE
key_id = 'a861fc66d2bddd0364cc26e0c7a086de1cad89d3324c89c01d9c7ba953219c92'
AND (
token = 'y0xEkW2BR5u8szzorIYkPMF1z6mtJHBHgxNAtku6vaI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)