UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r9OkjsJBu5p3wxJ1mVNUJ73b4bLSKI2bsGuRZd6q5dg='
WHERE
key_id = '059581be05afac937dea8c40cbe69b5e6cc43a2ef3c6a6fa873b7cd3db5cd3d1'
AND (
token = 'r9OkjsJBu5p3wxJ1mVNUJ73b4bLSKI2bsGuRZd6q5dg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)