UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n+6GvxYMZray7a0gQXMm9uzT1amiMtMzZnzYAV1TILE='
WHERE
key_id = 'c630a2f507de8cf3cea9c5c2705be9a7f7a9269e27db98b5f98d0febe500d17b'
AND (
token = 'n+6GvxYMZray7a0gQXMm9uzT1amiMtMzZnzYAV1TILE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)