UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pUPB67k+kBYH2A6Wfx5x2pBRaqggqDXLh14t2jcDYZU='
WHERE
key_id = 'b6fad2818d5b455da8daae173554327995229d7ca1868b3d4a3a772b62878ea7'
AND (
token = 'pUPB67k+kBYH2A6Wfx5x2pBRaqggqDXLh14t2jcDYZU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)