UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'maTEvBljPQU1LkM2/s9ccM9O0I8OBKwSs1TbOtO2vj0='
WHERE
key_id = 'ebf030a0f658c4e78768b53e59b54d97b81bbff1d6a793c6b7dd130626cda481'
AND (
token = 'maTEvBljPQU1LkM2/s9ccM9O0I8OBKwSs1TbOtO2vj0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)