UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hjdk0NGgaH7TSC0lGQJ7QdmLzT8mOBOaePKAq1kOHJM='
WHERE
key_id = 'd5a161cc8ed6993048cc956658f049153ce2bc1d06589e93b64f04e55affd52a'
AND (
token = 'hjdk0NGgaH7TSC0lGQJ7QdmLzT8mOBOaePKAq1kOHJM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)