UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r5K+iHIxoYOmLm+gDjqLCZmDzcqPCTdyXNXM+30cOBk='
WHERE
key_id = '38f05aec3b3b3decced18d540f4284465ef1e5b0e9143dbaca15ac9a3ebe9a2d'
AND (
token = 'r5K+iHIxoYOmLm+gDjqLCZmDzcqPCTdyXNXM+30cOBk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)