UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EA+EK6nOFnBdCy0fEPK7i01QR+9e4sPshSxXNhhSH7U='
WHERE
key_id = 'dbe3f51a39c3939a6d859f4686c2d6f36650599f038a72a7d51e7dc4562fb887'
AND (
token = 'EA+EK6nOFnBdCy0fEPK7i01QR+9e4sPshSxXNhhSH7U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)