UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BwgCtJKjDQ5VZN51Vhy2TF9REJZnYQb6XY0tSUIYBNk='
WHERE
key_id = 'b599069463329a0a637cd4bd1580150180cf7b2c83f651dd54488b8c34e2449a'
AND (
token = 'BwgCtJKjDQ5VZN51Vhy2TF9REJZnYQb6XY0tSUIYBNk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)