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