UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z8YRHGt++ofdxkY3Y7tPct7BXv35OtW9E6W2UrvAsMY='
WHERE
key_id = 'fae50063757fabf8d90b804a6b0291ad06e64ac57fff9ba99b731c3f80a12f02'
AND (
token = 'Z8YRHGt++ofdxkY3Y7tPct7BXv35OtW9E6W2UrvAsMY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)