UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i11lDntbtoY5xWkXLPYkA5PfblESJY7ku/3pNLAKTtc=' 
WHERE 
  key_id = '6346897aa2b1087a7abc32280c3dc6f655ecd13d5a165ccfa6d28bca805083df' 
  AND (
    token = 'i11lDntbtoY5xWkXLPYkA5PfblESJY7ku/3pNLAKTtc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039