UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BR5+CBW+4yEUOYOkfAPQomombFLsKffRIhqayRW4j20='
WHERE
key_id = 'f1f5475d009304f26019e952a0a53240256ffe6950fde4f88b7105323b33f317'
AND (
token = 'BR5+CBW+4yEUOYOkfAPQomombFLsKffRIhqayRW4j20='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)