UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xs9alhmDSUZ5tpOIpjIiGA1Lp2yJaFD3kna+MweLUU8='
WHERE
key_id = 'a4aace8ebae643d002200cb71a6c63c62bde70ee5dea25889288f139f3467206'
AND (
token = 'xs9alhmDSUZ5tpOIpjIiGA1Lp2yJaFD3kna+MweLUU8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)