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