UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4sbg1vSiLMH+Axyou4PaTacCb5J4CbQESlRj1Or+TJ0='
WHERE
key_id = '1670ad9f9bf20c6f385f1fa1efeec36a7aa6abe1737b98bef6a5cf1a1707574c'
AND (
token = '4sbg1vSiLMH+Axyou4PaTacCb5J4CbQESlRj1Or+TJ0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)