UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '89J9ccVtmpbDk5zjg4HsrgkyzIMYtYyWQ6+ulx48ib4=' 
WHERE 
  key_id = '97301bb8e635c0e6a4b709d1dad2070a1f2795579ece2b244675abe38f6e5721' 
  AND (
    token = '89J9ccVtmpbDk5zjg4HsrgkyzIMYtYyWQ6+ulx48ib4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052