UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tia2WBBhEvi3cQGW575rWG9GT47X3Z/xSKjmcNuQEds='
WHERE
key_id = 'a5d88e670076098a6be6a182bc0bb4be20068c17d45a589b4ee58b801434fe8f'
AND (
token = 'tia2WBBhEvi3cQGW575rWG9GT47X3Z/xSKjmcNuQEds='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)