UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tyz9oAct+nOLfv6NIS6G1ztKpVEuFCnrGHX4hSXInzA='
WHERE
key_id = 'a14b7658978376f7f4e4d75e900edfeaae45d4791562bdfd8c45676ce743dbde'
AND (
token = 'tyz9oAct+nOLfv6NIS6G1ztKpVEuFCnrGHX4hSXInzA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)