UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JPb0O9X+E2fANnpdeHMZOal0PKkAqfJGrwlCQHVwafA='
WHERE
key_id = 'd320899132bdb82a8e82165d9ee0742d43a6fe43d6086b03acd6f96b4e78fc8c'
AND (
token = 'JPb0O9X+E2fANnpdeHMZOal0PKkAqfJGrwlCQHVwafA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)